﻿<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>小程序网站</title>
</head>
<link rel="stylesheet" href="/css/home.css">
<link rel="stylesheet" href="/css/product.css" />
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script src="/Scripts/jquery.js"></script>
<script src="/plugins/layer/layer.js"></script>
<script src="/Scripts/com.js"></script>
<script src="/Scripts/config.js"></script>
<script src="/Scripts/contact.js"></script>
<body>
    <div class="header">
        <div class="header-mid">
            <div class="header-mid-lft">
                <img src="/images/1loog.png" alt="" class="sitelogo title hide">
            </div>
            <div class="header-mid-rgt">
                <div class="phone-number" style="width:200px;margin-top:27px;color:gray;margin-right: 14px;font-family: SimHei,微软雅黑">服务热线：<span class="store-phone">400-600-9138</span></div>
                <!--<div class="header-input">
                    <input class="header-input_ip" type="text" name="" value="" placeholder="全站搜索">
                    <img src="/images/2.png" alt="" class="input-img">
                </div>-->

            </div>
        </div>
    </div>
    <!--导航-->
    <div class="navbar">
        <div class="navbar-rel pc_index_nav">
            <div class="navbar-rel-item" style="margin-left:20px;" onClick="location.href='index.html'">
                <span>首页</span>
            </div>
        </div>
    </div>

    <div class="content">
        <div class="content-list">
            <div class="list">
                <ul class="yiji"></ul>
            </div>
        </div>

        <!--商品列表-->
        <div class="product-list">

        </div>
    </div>
    <div id="contact" class="contact-back">
        <script language="javascript">
            contact();
        </script>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            getStoreInfo();
            GetNavList(1);
            getProductList();
            getClassList();
        });


        function getClassList() {
            var storeCid = getQueryString("linkid");
            var url = siteUrl.fotmatUrl(siteUrl.StoreClassList);
            AjaxGet(url, "", function (data) {
                if (!checkCode(data)) {
                    Alert(data.Message);    //显示错误消息
                    return;
                }
                if (!emptyData(data))
                    return; //显示空数据提示

                var html = "";
                var list = data.Data;
                for (var i = 0; i < list.length; i++) {
                    var item = list[i];
                    var url = siteUrl.htmlUrl.ProductList.replace("{storeid}", storeInfo.storeId).replace("{linkid}", item.StoreCid);
                    html += "<li><a class='inactive1 a_" + item.StoreCid + "' href='" + url + "'><span class='list-span'>" + item.Name + "</span></a></li>";
                }
                $(".list .yiji").html(html);
                $(".yiji .a_" + storeCid).addClass("on");	//选中分类
                $(".yiji .a_" + storeCid + " span").addClass("on");
            });
        }


        function getProductList() {
            var linkid = getQueryString("linkid");
            var linkType = getQueryString("linktype");
            var url = siteUrl.fotmatUrl(siteUrl.ProductList.replace("{cateid}", linkid));
            AjaxGet(url, "", function (data) {
                if (!checkCode(data)) {
                    Alert(data.Message);    //显示错误消息
                    return;
                }
                if (!emptyData(data)) {
                    return; //显示空数据提示
                }
                var html = "";
                var list = data.Data.ProductList;
                if (list == []) {
                    html = "<span style='border:2px solid gray;'>没有数据</span>";
                }
                for (var i = 0; i < list.length; i++) {
                    var item = list[i];
                    var src = "/images/1.jpg";
                    if (item.ShowImg != null)
                        src = siteConfig.imgPath.product.replace("{storeid}", storeInfo.storeId) + item.ShowImg;
                    var url = siteUrl.htmlUrl.ProductDetail.replace("{storeid}", storeInfo.storeId).replace("{pid}", item.Pid)
                    var name = item.Name.length > 22 ? item.Name.substring(0, 22) : item.Name;
                    html += "<div class='showipc3-item' data-pid='" + item.Pid + "'>";
                	//html += "<div class='showipc3-item-tp'><a href='" + url + "' target='_blank'><img src='" + src + "' class='showipc3-item-tp-img'></a></div>";
                    html += "<a href='" + url + "' target='_blank'><div class='showipc3-item-tp' style='background: url(" + src + ") no-repeat;background-size: cover;'></div></a>";
                    html += "<div class='showipc3-item-mid'><a href='" + url + "' target='_blank'>" + name + "</a></div>";
                    html += "<div class='showipc3-item-btm'>¥ " + item.ShopPrice + "</div>";
                    html += "</div>"
                }
                $(".product-list").html(html);
            });

        }

    </script>
</body>
</html>
